package StudyCode.summary.BufferAndChannel;

import java.io.*;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class GetStreamFromBufferedReader {
	public static void main(String[] argv) {
		String file = "E:/迅雷下载/test1.txt";
		System.out.println(getStream(file));
	}

	private static InputStream getStream(String file) {
		File f = new File(file);
		String total = "";
		try {
			BufferedReader r = new BufferedReader(new FileReader(f));
			String s = r.readLine();
			while (s != null) {
				total += s + "\n";
				s = r.readLine();
			}
			r.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ByteArrayInputStream(total.getBytes());

	}
}
